<!DOCTYPE html>
<html>

<head>
	<meta charset="utf-8">
	<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
	<meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
	<title></title>
	<link rel="stylesheet" type="text/css" href="../css/aui.css" />
	<style>
		.aui-list .aui-list-item-inner {
			min-height: 3.2rem;
		}
	</style>
</head>

<body>
	<header class="aui-bar aui-bar-nav" id="header">
		登录
	</header>
	<div class="aui-content aui-margin-b-15">
		<ul class="aui-list aui-form-list">
			<li class="aui-list-item">
				<div class="aui-list-item-inner">
					<div class="aui-list-item-label-icon">
						<i class="aui-iconfont aui-icon-my"></i>
					</div>
					<div class="aui-list-item-input">
						<input type="text" placeholder="用户名" id="username" value="">
						<!--yk_worker   _worker2  ykqn-->
					</div>
				</div>
			</li>
			<li class="aui-list-item">
				<div class="aui-list-item-inner">
					<div class="aui-list-item-label-icon">
						<i class="aui-iconfont aui-icon-lock"></i>
					</div>
					<div class="aui-list-item-input">
						<input type="password" placeholder="密&nbsp;&nbsp;&nbsp;&nbsp;码" id="password" value="">
					</div>
				</div>
			</li>
			<li class="aui-list-item" id="code_list" style="display:none;">
				<div class="aui-list-item-inner">
					<div class="aui-list-item-label-icon">
						<i class="aui-iconfont aui-icon-cert"></i>
					</div>
					<div class="aui-list-item-input">
						<input type="password" placeholder="授权码" id="code" value="">
					</div>
				</div>
			</li>
			<li class="aui-list-item">
				<div class="aui-list-item-inner aui-list-item-center aui-list-item-btn">
					<div class="aui-btn aui-btn-info aui-btn-block" id="btnLogin">
						登录
					</div>
				</div>
			</li>
		</ul>
	</div>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript" src="../script/util.js"></script>
<script type="text/javascript">
	apiready = function() {
		api.parseTapmode();
		//$api.fixStatusBar($api.byId('header'));
		//var idCard = api.require('moduleIdCard');
		//idCard.startIDScanner();
		//idCard.startActivity();
		//console.log(api.deviceId);

		var header = $api.dom('header');
		var headerH = $api.fixStatusBar(header);
		if ('undefined' != typeof($api.getStorage('username'))) {
			$api.val($api.byId('username'), $api.getStorage('username'));
			$api.val($api.byId('password'), $api.getStorage('password'));
		}

		if ("PDA401"!=api.deviceModel) {
			$api.css($api.byId('code_list'), 'display:block');
			$api.val($api.byId('code'), $api.getStorage('code'));
		}

		$api.addEvt($api.byId('btnLogin'), 'click', function() {
			var username = $api.val($api.byId('username'));
			var password = $api.val($api.byId('password'));
			if ("PDA401"===api.deviceModel) {
				login(username, password);
			}else {
				var code = $api.val($api.byId('code'));
				if ("041712349"===code) {
					$api.setStorage('code', code);
					login(username, password);
				}else {
					tips('授权码不正确',null,'div');
				}
			}

		});
	};
</script>

</html>
